import pkuseg
import gensim
import re
import openpyxl

seg = pkuseg.pkuseg(model_name='default',user_dict = "D://皮炎参数//凝血.txt")
dict_ige = dict()
with open('D://皮炎参数//凝血.txt',encoding='utf-8') as f:
    lines = f.readlines()
f.close()
size=0
for line in lines:
    line = line.strip('\n')
    dict_ige[str(line)]=size
    size=size+1
print(dict_ige)
b=[0]*4
strs="DIC示纤维蛋白原4.98 g/L，D-二聚体0.98 mg/l FEU；"
with open('D://皮炎参数//ige停用词.txt',encoding='utf-8') as f:
    lines = f.readlines()
    for line in lines:
        line = line.strip('\n')
        print(str(line))
        strs=re.sub(str(line),' ',strs)
f.close()
text=seg.cut(strs)
for ch in range(0,len(text)):
    if text[ch] in dict_ige.keys():
        b[dict_ige[text[ch]]-1]=text[ch+1]
print(b)